/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package FrameWork;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

/**
 *
 * @author ThanhTri
 */
public class MySpriteFont {
    protected Image m_Image;
    protected int m_ArrayWidth[];
    protected int m_HeightFont;

    public MySpriteFont(Image m_Image) {
        this.m_Image = m_Image;
    }
    public int ChoseFrame (int _C){
        return 0;
    }
    public void DrawString (String _Text,int _x,int _y,
            Graphics _Graphics){
        int X=_x;
	int n=_Text.length();
	for(int i=0;i<n;i++)
	{
            int frame = ChoseFrame((int)_Text.charAt(i) );
            
            _Graphics.drawRegion(m_Image, m_ArrayWidth[frame], 0, 
                    m_ArrayWidth[frame+1]-m_ArrayWidth[frame], m_HeightFont, Sprite.TRANS_NONE,
                    X, _y, Graphics.TOP|Graphics.LEFT);
            X +=  m_ArrayWidth[frame+1]-m_ArrayWidth[frame];
	}
        		

    }
    
}
